@import '../cirodown.common.scss';

$border-radius: 10px;
$nav-background-color: #AA0;
$toplevel-padding: 20px;

body {
@include body;
margin: 0;
background-color: $background-color;

/* Scrollbar behaviour.
 * We would like to get rid of the X scrollbar and keep only the Y one.
 * The below would remove both on Chromium 81 and neither on Firefox 75.
 * So for now we just keep both.
 * https://stackoverflow.com/questions/3296644/hiding-the-scroll-bar-on-an-html-page
 * https://stackoverflow.com/questions/20997183/how-to-hide-scrollbar-in-firefox
 * https://stackoverflow.com/questions/20713769/horizontal-only-webkit-scrollbar-style-css
 */
/*
overflow-x: visible;
scrollbar-width: none;
&::-webkit-scrollbar {
  display: none;
}
*/

button, a.btn {
  $button-bg-color: rgb(239, 239, 239);
  $button-fg-color: black;
  border-radius: 3px;
  cursor: pointer;
  display: inline-block;
  font-size: 15px;
  font-weight: bold;
  line-height: 28px;
  padding: 2px 5px;
  text-decoration: none;
  margin: 0;
  &, &:hover.active {
    background-color: $button-bg-color;
    color: $button-fg-color;
    border: 1px solid $button-fg-color;
  }
  &:hover, &.active {
    background-color: #FF1493;
    color: white;
    //border-color: $button-bg-color;
  }
}

footer {
  margin-top: 10px;
  a {
    $background-color: #00C;
    color: $background-color;
    text-decoration: none;
    &:visited {
      color: $background-color;
    }
    &:hover {
      text-decoration: underline;
    }
  }
  padding: 10px $toplevel-padding;
  div + div {
    margin-top: 5px;
  }
}

footer, nav.navbar {
  background-color: $nav-background-color;
  color: $background-color;
}

form {
  input, textarea {
    background-color: $background-color;
    border: 1px solid gray;
    border-radius: 3px;
    color: white;
    margin-bottom: 10px;
    width: 100%;
    &::placeholder {
      color: #AAA;
    }
    // Unable to make it work for password fields.
    // https://stackoverflow.com/questions/55131944/how-to-remove-blue-background-on-chrome-autocomplete
  }
  label {
    font-weight: bold;
    div.label {
      margin-bottom: 5px;
    }
  }
}

nav.navbar {
  $font-size: 24px;
  /* https://stackoverflow.com/questions/5078239/how-do-i-remove-the-space-between-inline-block-elements */
  font-size: 0;
  display: flex;
  height: $font-size * 1.2;
  margin-bottom: 10px;
  .navbar-list {
    display: flex;
    margin-left: auto;
  }
  a {
    /* Make buttons occupy the full height of the header bar.
    * https://stackoverflow.com/questions/28254332/how-to-vertically-center-the-contents-of-a-flexbox-item/28254903#28254903 */
    align-items: center;
    align-self: stretch;

    color: $background-color;
    display: flex;
    font-size: 24px;
    font-weight: bold;
    margin-left: 0;
    margin-right: 0;
    padding-left: 10px;
    padding-right: 10px;
    text-decoration: none;
    &:visited {
      color: $background-color;
    }
    &:hover, &.active {
      color: $nav-background-color;
      background-color: $background-color;
    }
    &.profile {
      padding-left: 0px;
    }
    img.profile-thumb {
      height: 100%;
      padding-right: 5px;
    }
  }
  &>:first-child {
    padding-left: $toplevel-padding;
  }
}

div.article-list-container {
  table.article-list {
    border-collapse: collapse;
    margin-bottom: 20px;
    width: 100%;
    tr {
      td, th {
        border: 1px solid $color;
        padding: 5px 10px;
        &.shrink {
          white-space: nowrap
        }
        &.expand {
          width: 100%
        }
        &.title {
          font-weight: bold;
        }
      }
    }
  }
}

div.article-meta {
  div.article-info {
    margin-bottom: 10px;
  }
  div.article-actions {
    button, a.btn {
      margin-right: 3px;
    }
  }
}

div.tab-list {
  margin: 20px;
  a.tab-item {
    padding-right: 10px;
    &.active {
      font-weight: bold;
    }
  }
}

/* Cirodown has a complex per-element padding structure that we can't easily override.
 * So for now we are taking the approach of adding this class to every content (non-hav/footer)
 * to make them align nicely with rendered Cirodown. */
.content-not-cirodown {
  padding-left: $toplevel-padding;
  padding-right: $toplevel-padding;
}

.comment {
  border: 1px solid $color;
  border-radius: $border-radius;
  margin-bottom: 10px;
  .comment-body {
    padding: 10px 10px;
  }
  .comment-header {
    border-bottom: 1px solid $color;
    border-radius: $border-radius $border-radius 0 0;
    background-color: #003300;
    padding: 10px 10px;
  }
}

.comment-form {
  border: 1px solid $color;
  border-radius: $border-radius;
  margin-bottom: 10px;
  .comment-form-textarea {
    border-bottom: 1px solid $color;
    padding: 5px 10px 2px 5px;
  }
  .comment-form-submit {
    padding: 10px;
  }
}

.error-message {
  display: flex;
  justify-content: center;
  .error-message-presenter {
    display: inline-block;
    margin: 20px auto;
    padding: 8px 15px;
    border-radius: 4px;
    color: #f02d2d;
    font-weight: 600;
    background: rgba(240, 45, 45, 0.1);
  }
}

.loading-spinner {
  position: relative;
  width: 40px;
  height: 40px;
  margin: 90px auto;
  border-radius: 50%;
  border-top: 3px solid rgba(0, 0, 0, 0.1);
  border-right: 3px solid rgba(0, 0, 0, 0.1);
  border-bottom: 3px solid rgba(0, 0, 0, 0.1);
  border-left: 3px solid #818a91;
  transform: translateZ(0);
  animation: spin 0.5s infinite linear;
  /* TODO the spinner appears broken, might be because of this typo that existed in the original.
   * We noticed it when migrating to SASS which does a compile check ;-). */
  /*
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
  */
}

/* https://github.com/gothinkster/angular-realworld-example-app/blob/9e8c49514ee874e5e0bbfe53ffdba7d2fd0af36f/src/app/shared/article-helpers/article-list.component.css#L1 */
.page-link {
  cursor: pointer;
}

.pagination {
  .page-item {
    &.active {
      font-weight: bold;
    }
  }
}

.profile-thumb {
  height: 26px;
  vertical-align: middle;
}

.username {
  font-weight: bold;
}
}
